load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
    name = "go_default_library",
    srcs = ["virt-operator.go"],
    importpath = "kubevirt.io/kubevirt/cmd/virt-operator",
    visibility = ["//visibility:private"],
    deps = [
        "//pkg/monitoring/client/prometheus:go_default_library",
        "//pkg/monitoring/reflector/prometheus:go_default_library",
        "//pkg/monitoring/workqueue/prometheus:go_default_library",
        "//pkg/virt-operator:go_default_library",
    ],
)

go_binary(
    name = "virt-operator",
    embed = [":go_default_library"],
    static = "on",
    visibility = ["//visibility:public"],
)

load(
    "@io_bazel_rules_docker//container:container.bzl",
    "container_image",
)

container_image(
    name = "version-container",
    base = "//:passwd-image",
    directory = "/",
    files = ["//:get-version"],
)

container_image(
    name = "virt-operator-image",
    architecture = select({
        "@io_bazel_rules_go//go/platform:linux_ppc64le": "ppc64le",
        "//conditions:default": "amd64",
    }),
    base = ":version-container",
    directory = "/usr/bin/",
    entrypoint = ["/usr/bin/virt-operator"],
    files = [
        ":virt-operator",
        "//tools/csv-generator",
    ],
    user = "1001",
    visibility = ["//visibility:public"],
)
